const defaultState = {
    visible: false,
    loading: false,
    model: {},
    transportType: []

};
export default function createLinePrice(state = defaultState, action) {
    const {type, error, payload} = action;
    switch (type) {
        case 'CLIENT.SHOW_CREATE_LINE_PRICE':
            return {...state, visible: true, model: {}};
        case 'CLIENT.HIDE_CREATE_LINE_PRICE':
            return {...state, visible: false, model: {}, transportType: []};
        case 'CLIENT.CREATE_LINE_PRICE':
            if (error === true) {
                return {...state, loading: false};
            }
            return {...state, loading: false, visible: false};
        case 'CLIENT.CREATE_LINE_PRICE_PENDING':
            return {...state, loading: true, model: {...payload}};
        case 'CLIENT.UPDATE_LINE_PRICE_MODEL':
            return {...state, model: {...payload}};
        case 'CLIENT.GET_TRANSPORT_TYPE':
            return {...state, transportType: [...payload]};
        default:
            return state;
    }
}

